package Thread;

/**
 * Created with IntelliJ IDEA.
 * Description: 课后作业：在20个子线程执行完毕后再执行主线程代码
 */
public class ThreadDemo18 {
    public static void main(String[] args) throws InterruptedException {
        for(int i = 0; i < 20; i++) {
            int tmp = i;
            Thread t = new Thread() {
                @Override
                public void run() {
                    System.out.print(tmp + " ");
                }
            };
            t.start();
        }
        Thread.sleep(2000);
        System.out.println("ok");
    }
}
